$('#submitBtn').click(function () {
    submitAction.s();
});

var submitAction = {
    v: function () {
        var username_v = $('#username').val();
        if (username_v == undefined || $.trim(username_v) == '') {
            divalert('用户名不能为空')
            return false;
        }
        var password_v =  $('#password').val();
        if (password_v == undefined || $.trim(password_v) == '') {
            divalert('密码不能为空')
            return false;
        }
        return true;
    },
    s: function () {
        var v_result = this.v();
        v_result ? document.forms[0].submit() : null;
    }
};

var divalert = function(msg){
    $(".flash-container").show();
    setTimeout(function(){
        $(".flash-container").fadeOut("slow");
    },1000)
}

if($('#errorFlag').val() == '1') {
    divalert('');
}

$(document).keyup(function(event){
    if(event.keyCode ==13){
        submitAction.s();
    }
});



